﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Runtime.InteropServices;

namespace ImPM.Application
{
    public sealed class ServerInfo
    {
        // Fields
        private string _name;

        // Methods
        public ServerInfo(string name)
        {
            this._name = name;
        }
            

        [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
        internal static extern bool GetVersionEx(ref OSVersionInfoEx osvi);

        public string ServerName
        {
            get
            {
                return this._name;
            }
        }

        // Nested Types
        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
        public struct OSVersionInfoEx
        {
            private int osVersionInfoSize;
            private int majorVersion;
            private int minorVersion;
            private int buildNumber;
            private int platformId;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x80)]
            private string csdVersion;
            private short servicePackMajor;
            private short servicePackMinor;
            private short suiteMask;
            private byte productType;
            private byte reserved;
            public int OSVersionInfoSize
            {
                set
                {
                    this.osVersionInfoSize = value;
                }
            }
            public int MajorVersion
            {
                get
                {
                    return this.majorVersion;
                }
            }
            public int MinorVersion
            {
                get
                {
                    return this.minorVersion;
                }
            }
            public int BuildNumber
            {
                get
                {
                    return this.buildNumber;
                }
            }
            public int PlatformId
            {
                get
                {
                    return this.platformId;
                }
            }
            public string CsdVersion
            {
                get
                {
                    return this.csdVersion;
                }
            }
            public short ServicePackMajor
            {
                get
                {
                    return this.servicePackMajor;
                }
            }
            public short ServicePackMinor
            {
                get
                {
                    return this.servicePackMinor;
                }
            }
            public short SuiteMask
            {
                get
                {
                    return this.suiteMask;
                }
            }
            public byte ProductType
            {
                get
                {
                    return this.productType;
                }
            }
        }
    }


}
